home *** CD-ROM | disk | FTP | other *** search
- Path: mer-news.ctron.com!vo
- From: vo@ctron.com (Huy Vo)
- Newsgroups: comp.lang.c
- Subject: Re: Macros in C (Disadvantages?)
- Date: 12 Jan 1996 16:00:58 GMT
- Organization: Cabletron Systems Inc
- Distribution: world
- Message-ID: <4d60jqINN8pe@mer-news.ctron.com>
- Reply-To: vo@porthos.ctron.com (Huy Vo)
- NNTP-Posting-Host: porthos.ctron.com
-
- bvarley@yarrow.wt.com.au (bruce varley) wrote:
- >
- >Here is an a example that illustrates the danger(s) of macros.....
- >
- >#define A 7
- >#define B 4+5
- >
- >C = A * B. This will produce 33.
- >
- I don't make this kind of mistake since I know B is 9 :)
- Moral of the story: fully parenthesize any macros composed of more than one token.
-
-
- --
- Huy Vo
- vo@ctron.com
-